package com.agv.core.dao.dataExtractor;

import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.util.HashMap;
import java.util.Map;

import org.springframework.dao.DataAccessException;
import org.springframework.jdbc.core.ResultSetExtractor;


public class TableTypeResultSetExtractor implements ResultSetExtractor{
	


	@Override
	public Map<String, Integer> extractData(ResultSet rs) throws SQLException,
			DataAccessException {
		
		
		Map<String, Integer> map = new HashMap<String, Integer>();

		ResultSetMetaData rsmd = rs.getMetaData();
		
		int numCols = rsmd.getColumnCount();
		for (int i = 1; i <= numCols; i++) {//el nombre d columna y el tipo SQL
			map.put( rsmd.getColumnName(i), rsmd.getColumnType(i) );
		}
		
		
		return map;
	}
	

}
